using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

using System.Runtime.InteropServices;

namespace s8rfdll
{

    public class PubClass
    {

        [DllImport("umf.DLL", EntryPoint = "fw_init")]
        public static extern Int32 fw_init(Int16 port, Int32 baud);
        [DllImport("umf.DLL", EntryPoint = "fw_config_card")]
        public static extern Int32 fw_config_card(Int32 icdev, Byte flags);
        [DllImport("umf.DLL", EntryPoint = "fw_exit")]
        public static extern Int32 fw_exit(Int32 icdev);


        [DllImport("umf.DLL", EntryPoint = "fw_beep")]
        public static extern Int32 fw_beep(Int32 icdev, UInt32 _Msec);
        [DllImport("umf.DLL", EntryPoint = "fw_getver")]
        public static extern Int32 fw_getver(Int32 icdev, byte[] buff);
        [DllImport("umf.DLL", EntryPoint = "hex_a")]
        public static extern void hex_a(ref Byte hex, Byte[] a, Int16 len);

        [DllImport("umf.dll", EntryPoint = "fw_rdCardStatus")]
        public static extern Int32 fw_rdCardStatus(Int32 icdev, int[] pSt);


        //===================================================
        //  4442/5542 card 
        [DllImport("umf.dll", EntryPoint = "fw_read_4442")]
        public static extern Int32 fw_read_4442(Int32 icdev, byte addr, byte[] data, int len);
        [DllImport("umf.dll", EntryPoint = "fw_write_4442")]
        public static extern Int32 fw_write_4442(Int32 icdev, byte addr, byte[] data, int len);
        [DllImport("umf.dll", EntryPoint = "fw_cntReadError_4442")]
        public static extern Int32 fw_cntReadError_4442(Int32 icdev, byte[] pCnt);
        [DllImport("umf.dll", EntryPoint = "fw_authentikey_4442")]
        public static extern Int32 fw_authentikey_4442(Int32 icdev, byte addr, int len, byte[] password);
        [DllImport("umf.dll", EntryPoint = "fw_changkey_4442")]
        public static extern Int32 fw_changkey_4442(Int32 icdev, byte addr, int len, byte[] password);
        [DllImport("umf.dll", EntryPoint = "fw_getProtectData_4442")]
        public static extern Int32 fw_getProtectData_4442(Int32 iccev, byte addr, byte[] proData, int len);
        [DllImport("umf.dll", EntryPoint = "fw_setProtectData_4442")]
        public static extern Int32 fw_setProtectData_4442(Int32 icdedv, byte addr, byte[] proData, int len);

        //===================================================
        //  4428/5528 card 
        [DllImport("umf.dll", EntryPoint = "fw_read_4428")]
        public static extern Int32 fw_read_4428(Int32 icdev, byte addr, byte[] data, int len);
        [DllImport("umf.dll", EntryPoint = "fw_write_4428")]
        public static extern Int32 fw_write_4428(Int32 icdev, byte addr, byte[] data, int len);
        [DllImport("umf.dll", EntryPoint = "fw_cntReadError_4428")]
        public static extern Int32 fw_cntReadError_4428(Int32 icdev, byte[] pCnt);
        [DllImport("umf.dll", EntryPoint = "fw_authentikey_4428")]
        public static extern Int32 fw_authentikey_4428(Int32 icdev, byte[] password);
        [DllImport("umf.dll", EntryPoint = "fw_changkey_4428")]
        public static extern Int32 fw_changkey_4428(Int32 icdev, byte[] password);
        [DllImport("umf.dll", EntryPoint = "fw_getProtectData_4428")]
        public static extern Int32 fw_getProtectData_4428(Int32 icdev, byte[] proData, int len);
        [DllImport("umf.dll", EntryPoint = "fw_setProtectData_4428")]
        public static extern Int32 fw_setProtectData_4428(Int32 icdev, byte[] proData, int len);
       
    }

}
